﻿var yanzhengEnter=0;
var yanzhengma;
var leave=0;
function show2(){

var w=screen.width;

var h=screen.width/2.1;


$(".main").css({"width":w,"height":h});
$(".footer").css("width",w);
$(".loginKuang").slideDown();
var s = $("#errorFlag").val();
if(s=="用户名不存在")
	{$("#tips").text("登陆失败：您的用户名不存在！！");
	setTimeout(function(){$("#tips").text('')},2000);
	}
if(s=="密码错误")
	{$("#tips").text("登陆失败：您输入的密码有误！！");
	setTimeout(function(){$("#tips").text('')},2000);
	}
	 
	change();

}

function change(){
	
	yanzhengma=Math.ceil(Math.random()*10000);
	$("#yanzhengshuzi").text(yanzhengma);
}


$(document).ready(function(){
	
	$("#name").focus(function(){
		
		$(this).animate({width:'260px'}).css("border","2px solid cyan")
	})
	$("#name").blur(function(){
		
		$(this).animate({width:'243px'}).css("border","1px solid ")
	})
	
	$("#password").focus(function(){
		
		$(this).animate({width:'260px'}).css("border","2px solid cyan");
	})
	$("#password").blur(function(){
		$(this).animate({width:'243px'}).css("border","1px solid ");
	
	})
	$("#yanzhengshurukuang").focus(function(){
		
		$(this).animate({width:'170px'}).css("border","2px solid cyan");
		yanzhengEnter=1;
	})
	$("#yanzhengshurukuang").blur(function(){
		
		leave=1;
	})
	$("#yanzhengshurukuang").mouseleave(function(){
		if(yanzhengEnter==1)
		{$(this).animate({width:'140px'}).css("border","1px solid ");
		}
		if($("#yanzhengshurukuang").val()!=yanzhengma&&yanzhengEnter==1&&leave==0)
			{
				$("#tips").text("您输入的验证码有误！请重新输入");
				
				$("#submits").attr("type","button");
				setTimeout(function(){$("#tips").text('')},1600);
			}
		
	
	})
	
	$("#yanzhengshuzi").click(function(){
		
		change();
		
	})
	
})



